#light

namespace CGraph.SchemaGraph

open CGraph.DirectedGraph

type EMinMaxValues =
    | Nothing = 0
    | Unbounded = 1
    
type MinMaxValue =
    | MinMaxNum of decimal
    | SpecialValue of EMinMaxValues

type IDatatypeVertex =
    interface CGraph.Generic.INamedObject
    
type ISimpleDatatypeVertex = interface end
    
type IComplexDatatypeVertex = interface end

type IComplexContent = interface end
/// Add attributes of simple content
type IComplexSimpleExtension = 
    interface IComplexContent
/// Remove attributes of simple content
type IComplexSimpleRestriction = 
    interface IComplexContent
/// Add attributes/elements of complex content
type IComplexComplexExtension = 
    interface IComplexContent
/// Remove attributes/elements of complex content
type IComplexComplexRestriction = 
    interface IComplexContent
    
type IMinMaxType =
    abstract Min : MinMaxValue with get
    abstract Max : MinMaxValue with get
    
type IParticle = 
    interface IMinMaxType
    
type ISequenceVertex =
    interface IParticle

type IChoiceVertex = 
    interface IParticle
    
type IAnyVertex = 
    interface IParticle

type IParticleElement =
    interface IParticle
    
type IGroupRef =
    interface IParticle

type ILocalAttributeVertex =
    interface CGraph.Generic.INamedObject
    abstract Default : string option with get
    abstract Fixed : string option with get

type IDocumentationVertex = 
    interface CGraph.Generic.IDocumentedObject
    
type IExtensionEdge = interface end

type IComplexContentEdge = interface end
    
type IListDerivationEdge = interface end

type IRestrictionEdge = interface end

type ILocalAttributeEdge = interface end

type IDatatypeReferenceEdge = interface end

type INamedDatatypeReferenceEdge =
    interface IDatatypeReferenceEdge
    interface CGraph.Generic.INamedObject

type IParticleEdge = interface end

/// Also implements IDocumentedObject
type IDocumentationEdge = interface end
    
type ISchemaEdgeCollection = 
    abstract Restrict : IDatatypeVertex -> IDatatypeVertex -> IRestrictionEdge
    abstract Extend : IDatatypeVertex -> IVertex -> IExtensionEdge
    abstract DeriveList : ISimpleDatatypeVertex -> ISimpleDatatypeVertex -> IListDerivationEdge
    abstract Document : IVertex -> string -> IDocumentationEdge
    //Add a local attribute vertex
    abstract AddLocalAttribute : IVertex -> ILocalAttributeVertex -> ILocalAttributeEdge
    //Reference a datatype from a property or attribute vertex
    abstract Reference : IVertex -> IDatatypeVertex -> IDatatypeReferenceEdge
    //Reference an object and 'rename' it.
    abstract NamedReference : string -> IVertex -> IDatatypeVertex -> INamedDatatypeReferenceEdge
    //Specify the content model if the complex type 'derives' from another
    abstract ComplexContent : IComplexDatatypeVertex -> IComplexContent -> IComplexContentEdge
    //Particles may be a sequence, a choice, and various other things.
    abstract Particle : IVertex -> IParticle -> IParticleEdge
    
type ISchemaVertexCollection =
    abstract CreateSimpleVertex : string -> ISimpleDatatypeVertex
    abstract CreateComplexVertex : string -> IComplexDatatypeVertex
    abstract CreateDocumentationVertex : string -> IDocumentationVertex
    abstract CreateLocalAttributeVertex : string -> string option -> string option -> ILocalAttributeVertex
    abstract CreateComplexSimpleExtension : unit -> IComplexSimpleExtension
    abstract CreateComplexSimpleRestriction : unit -> IComplexSimpleRestriction
    abstract CreateComplexComplexExtension : unit -> IComplexComplexExtension
    abstract CreateComplexComplexRestriction : unit -> IComplexComplexRestriction
    abstract CreateChoice : MinMaxValue -> MinMaxValue -> IChoiceVertex
    abstract CreateSequence : MinMaxValue -> MinMaxValue -> ISequenceVertex
    abstract CreateAny : MinMaxValue -> MinMaxValue -> IAnyVertex
    abstract CreateParticleElement : MinMaxValue -> MinMaxValue -> IParticleElement
    abstract CreateGroupRef : MinMaxValue -> MinMaxValue -> IGroupRef
    
type ISchemaGraph =
    abstract Vertexes : ISchemaVertexCollection with get
    abstract Edges : ISchemaEdgeCollection with get